<div class="container member-container">
    <?php include $this->getViewFile('../lib/leftmenu'); ?>
    <div class="col-md-10 member-con menber-score-con">
        <div class="title mb-common-title">报名宝贝
            <?php if($pay_btn == 1): ?>
            
            <a class="pay-btn" href="<?php echo YzwController::U('paybm') ?>" target="_blank">快速付费报名</a>
            <span class="qq">咨询QQ:<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=830584&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:830584:41" alt="咨询客服" title="咨询客服"/></a></span>
<!--            <span class="qq">暂停招商</span>-->
            <?php endif; ?>
        </div>
        
        <div class="content" >
            <table>
                <thead>
                    <tr>
                        <td width="150">商品</td>
                        <td width="80">活动价</td>
                        <td width="200">报名时间</td>
                        <td width="100">报名分类</td>
                        <td width="150">状态</td>
                        <td width="200">操作</td>	                    
                    </tr>
                </thead>
                <tbody>
                    <?php if ($goods): ?>
                    <?php foreach ($goods as $good): ?>
                        <tr>
                            <td><a href="<?php echo $good->detail_url ?>" target="_blank"><img src="<?php echo $good->product_img ?>" width="80" height="80" /></a></td>
                            <td><?php echo $good->promo_price ?></td>
                            <td><?php echo date("Y-m-d H:i:s", $good->add_time); ?></td>
                            <td><?php echo $cats[$good->cat_id]['cat_name']; ?></td>
                            <td id="status_<?php echo $good->goods_id ?>" ><?php echo $good->getHtmlStatus($good); ?></td>
                            <td id="operation_<?php echo $good->goods_id ?>" ><?php echo $good->getMemberBmMayAction($good); ?></td>
                        </tr>
                    <?php endforeach ?>   
                    <?php endif ?>   
                    <?php if ($pages && $pages->pageCount > 1): ?>
                        <tr>
                            <td colspan="5" class="pager">
                                <?php
                                $this->widget('CLinkPager', array(
                                    'header' => "",
                                    'firstPageLabel' => '首页',
                                    'lastPageLabel' => '末页',
                                    'prevPageLabel' => '上一页',
                                    'nextPageLabel' => '下一页',
                                    'pages' => $pages,
                                    'footer' => "<span>共<em>{$pages->pageCount}</em>页</span>",
                                    'maxButtonCount' => 5
                                        )
                                );
                                ?>
                            </td>
                        </tr>
                    <?php endif ?>
                </tbody>

            </table>
        </div>
        
        
    </div>
    <div class="clearfix"></div>

    <div id="froms" style="display:none">
            <table >
                <tbody>
                    <tr>
                      <th width="100">快递公司</th>
                      <td><input type="text" name="company" value="" class="" id="company" placeholder="快递公司"></td>
                    </tr>
                    <tr>
                      <th width="100">快递单号</th>
                      <td><input type="text" name="numbers" value="" class="" id="numbers" placeholder="快递单号"></td>
                    </tr>

                </tbody> 
            </table>       
    </div>

</div>

<script src="<?php echo Yii::app()->params->staticUrl; ?>statics/js/ajaxForm.js"></script> 
<link rel="stylesheet" href="<?php echo Yii::app()->params->staticUrl; ?>statics/js/artDialog6/css/ui-dialog.css">
<script src="<?php echo Yii::app()->params->staticUrl; ?>statics/js/artDialog6/js/dialog-min.js"></script> 

<script type="text/javascript">
    $(function(){
        $(document).on('click', '.bm_query_g', function(){
            var obj = $(this);
            var url = obj.attr('href');
            var goods_id = obj.data('goods_id');

            var dialogs = dialog({
                title:'请填写相关信息',
                okValue:'确定',
                ok:function(){
                    var company = $(".ui-dialog-content [name='company']").val();
                    var numbers = $(".ui-dialog-content [name='numbers']").val();
                    var dia =   dialog({
                                    title: '提示',
                                    cancel: false,
                                    okValue: '确定',
                                    ok: function() {
                                    }
                                });

                    if(!company){
                        dia.content('快递公司名称不能为空');
                        dia.show();
                        return false;
                    }
                    if(!numbers){
                        dia.content('订单号不能为空');
                        dia.show();
                        return false;
                    }

                    $.post(url, {company:company, numbers:numbers}, function(data){
                        if(data.status){
                            $("#operation_" + goods_id).html(data.html_operation);
                            $("#status_" + goods_id).html(data.html_status);
                        }
                        dia.content(data.info);
                        dia.show();
                        return false;                                                
                    }, 'json');
                    return true;
                },
                cancelValue:'取消',
                cancel:function(){
                    return true;
                },
                content:$("#froms").html(),

            });
            $(".ui-dialog-content [name='company']").val($("#company_" + goods_id).val());
            $(".ui-dialog-content [name='numbers']").val($("#numbers_" + goods_id).val());
            

            dialogs.show();
            return false;

        })
    })
</script>





